<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>列表</title>
</head>
<script src="js/jquery-1.8.1.js"></script>
<body>
<div id="main">

</div>
<script>
    window.onload = function() {
        $(function () {
            $.ajax({
                url: "/file/getFiles?path=D:/file/photo", //路径 只需改为你的路径即可
                type: "get",
                dataType: "json",
                success: function (data) {
                    var html = "";
                    for (var e in data) {
                        // html+='文件名:'+data[e]+'<button class="file" value="'+data[e]+'">播放</button><br>';
                        // html+='文件名:'+data[e]+'<button class="file" value="'+data[e]+'">播放</button><br>';
                    }
                    $("#main").append(html);
                    $(".file").click(function () {
                        var link = document.createElement('a');
                        var str1 = "http://192.168.0.27:8001/file/"+ $(this).attr("value");
                        link.href = str1;
                        link.click();
                    });

                }
            })
        });
    }
</script>
</body>
</html>